package com.example.javasystem.mapper;

import com.example.javasystem.entity.PreprocessingConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;


@Mapper
public interface PreprocessingMapper {
    // 获取默认配置信息
    @Select("select * from preprocess_table")
    PreprocessingConfig selectDefaultValue();

    // 持久化存储（添加@Param注解）
    @Update("update preprocess_table set " +
            "temp_min = #{tempMin}, " +
            "temp_max = #{tempMax}, " +
            "ph_min = #{phMin}, " +
            "ph_max = #{phMax}, " +
            "acetic_min = #{aceticMin}, " +
            "acetic_max = #{aceticMax}, " +
            "alcohol_min = #{alcoholMin}, " +
            "alcohol_max = #{alcoholMax} " +
            "where id = 0")
    boolean isStorage(
            @Param("tempMin") BigDecimal tempMin,
            @Param("tempMax") BigDecimal tempMax,
            @Param("phMin") BigDecimal phMin,
            @Param("phMax") BigDecimal phMax,
            @Param("aceticMin") BigDecimal aceticMin,
            @Param("aceticMax") BigDecimal aceticMax,
            @Param("alcoholMin") BigDecimal alcoholMin,
            @Param("alcoholMax") BigDecimal alcoholMax
    );
}
